
set (LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/libs)


find_package(BISON 3.5.1)
find_package(FLEX 2.6.4)

if(FLEX_FOUND AND BISON_FOUND)
    FLEX_TARGET(scan scan.ll
        ${CMAKE_CURRENT_BINARY_DIR}/scanner.cc)

    BISON_TARGET(gram parse.yy
        ${CMAKE_CURRENT_BINARY_DIR}/parser.cc)

    ADD_FLEX_BISON_DEPENDENCY(scan gram)
    include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

#    set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR})
endif()

add_library(fserver_mysql_parser
  MySQLParser.cc
	${BISON_gram_OUTPUTS}
  ${FLEX_scan_OUTPUTS}
  )

add_library(fserver_mysql
  MySQLRequest.cc
  MySQLTCPHandler.cc
  )


target_link_libraries(fserver_mysql fserver_mysql_parser)
